import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { Nyt7PremiumSubsidyInfoVO, Nyt7PremiumSubsidyInfoForm, Nyt7PremiumSubsidyInfoQuery } from '@/api/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo/types';

/**
 * 查询保费补贴比例列表
 * @param query
 * @returns {*}
 */

export const listNyt7PremiumSubsidyInfo = (query?: Nyt7PremiumSubsidyInfoQuery): AxiosPromise<Nyt7PremiumSubsidyInfoVO[]> => {
  return request({
    url: '/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询保费补贴比例详细
 * @param id
 */
export const getNyt7PremiumSubsidyInfo = (id: string | number): AxiosPromise<Nyt7PremiumSubsidyInfoVO> => {
  return request({
    url: '/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增保费补贴比例
 * @param data
 */
export const addNyt7PremiumSubsidyInfo = (data: Nyt7PremiumSubsidyInfoForm) => {
  return request({
    url: '/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改保费补贴比例
 * @param data
 */
export const updateNyt7PremiumSubsidyInfo = (data: Nyt7PremiumSubsidyInfoForm) => {
  return request({
    url: '/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除保费补贴比例
 * @param id
 */
export const delNyt7PremiumSubsidyInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo/' + id,
    method: 'delete'
  });
};




// 添加 exportSelected 方法
/**
 * 导出选中的保费补贴比例列表
 * @param ids
 */
export const exportSelected = (ids: number[]): AxiosPromise<Blob> => {
  return request({
    url: '/Nyt7PremiumSubsidyInfo/Nyt7PremiumSubsidyInfo/exportSelected',
    method: 'post',
    data: ids,
    responseType: 'blob'
  });
};
